1. Graphing solutions to differential equations.
We illustrate how to use Maple to solve differential equations. Consider the differential equation:
> deq:=D(y)(x)=x*ln(x);
To solve this differential equation in Maple, we type the following command.
> dsolve(deq);
Notice that the undetermined constant is denoted by _C1, instead of C. This is done by Maple in order to pick a name for the constant that is not likely to conflict with constants that you may have defined elsewhere. To find a solution with a specific value of the constant, we substitute:
> subs(_C1=3,dsolve(deq));
In order to use the plot command to plot this function, we need to extract the right hand side of the equation above.
> func:=rhs(subs(_C1=3,dsolve(deq)));
> plot(func,x=1..4);
Suppose that we want to plot a whole sequence of these functions at once. Then we can use the seq command to create a collection of different solutions as follows:
> expr:=rhs(dsolve(deq));
> funcs:=seq(subs(_C1=k,expr),k=-2..2);
> plot([funcs],x=1..4);
It is easy to see from the picture above that all of these different solutions differ by a constant. Next, let us determine a solution which satisfies some specific condition. To find the solution which passes through the point (
), we substute x=2 and y=5 into the general solution, and solve for the constant _C1.
> subs(y(x)=5,x=2,dsolve(deq));
> solve(%,_C1);
> subs(_C1=6-2*ln(2),dsolve(deq));
> plot(rhs(%),x=1..4);
Submission:
For each of the following differential equations:
(a) Find the solution containing the arbitrary constant C .
(b) Graph the solutions for
on the same set of axes.
(c) Find and graph the solution that passes through the specified point
over the given interval [a,b].
y' =
, [
] ,
y' =
, [
] ,
y' =
, [
],
y' =
, [
] ,
Submission worksheet:
2. Solutions to Autonomous differential equations.
An autonomous differential equation is one of the form
where f is some function. It is called autonomous because the right hand side depends only on the dependent variable
y
, and not on the independent variable.
A more complicated example is given by the autonomous differential equation below, which has two equilibrium solutions,
and
.
> deq:=D(y)=(y-1)*(y-3);
By differentiating this differential equation, we find that
> D(deq);
> factor(%);
so that any solution which crosses the line
has an inflection point there. Notice that the second derivative also vanishes at the points where
, which are not inflection points on the graph. The sign of D(y) must be taken into account when determining the concavity of the solution. Thus we have the following decomposition, which will enable us to construct the phase line and understand the graphs of the solutions easily:
When
y
is in the interval (
)
and
, so
, and the curve is concave down and the function is increasing.
When
y
is in the interval (
),
and
, so
and the curve is concave up and the function is decreasing.
When
y
is in the interval (
),
and
, so
and the curve is concave down and the function is decreasing.
When
y
is in the interval (
),
and
, so
and the curve is concave up and the function is increasing.
Let us illustrate how the solution look by using Maple to plot some solutions to this differential equation. To do this, first load the differential equations package by executing the command below.
> with(DEtools):
Warning, the name translate has been redefined
Next, we are going to plot some solutions corresponding to various initial conditions. The non equilibrium solutions come in three basic forms, those for which y<1, those for which 1<y and y<2, and those for which y>2. Let us define some initial conditions for Maple to use to plot some solutions.
> initcond:=[[y(0)=0],[y(0)=0.5],[y(0)=1.25],[y(0)=1.5],[y(0)=2.5],[y(0)=2.75],[y(0)=3.5],[y(0)=4]];
We will use these initial conditions to plot various solutions using the
DEplot command. In order to use Maple's differential equation plotter, it is necessary to tell Maple that y is a function of some independent variable. Thus we need to modify the description of the differential equation, replacing
y
with
in the differential equation above.
> deq:=D(y)(x)=(y(x)-1)*(y(x)-3);
> DEplot(deq,y(x),x=-2..2,initcond,y=-0..5,linecolor=blue);
Notice that the curves which pass through the line
all have an inflection point there. You may notice that there are no relative extrema in any of the solutions. This is a general property of autonomous differential equations. From the picture, it is very easy to see that
is a stable equilibrium and
is an unstable equilibrium.
For the differential equation
:
(a) Make a table showing the intervals on which the function is increasing and is concave up or down, as was done in the example. You will need to find where the derivative is equal to zero, as well as where the second derivative is equal to zero in order to determine this.
(b) Use the DEplot command to plot solution curves for the differential equation. Plot at least one curve in each interval between equilibrium solutions. Use the independent variable t.
(c) Determine the stable and unstable equilibria.
Submission worksheet:
The differential equation
shows up in many applications. It can be used to describe the notion of
social diffusion
, e.g. the spreading of information. We can divide a population into two classes, those that have the information and those that do not. It is reasonable to assume that the spread of information would be proportional to the product of those that have the information and those that do not. This differential equation describes exactly that situation. The differential equation is given by
> deq:=D(X)(t) = k*X(t)*(N-X(t));
In this activity, we discuss how to solve the differential equation exactly, rather than graphically, using Maple's differential equation solving capabilities. Let us solve it explicitly.
> dsolve(deq,X(t));
Note that the solution involves an arbitrary constant _C1, which is determined by the initial condition
. We could either solve for the constant, or we could put the initial condition into the
dsolve command as follows.
> dsolve({deq,X(0)=C},X(t));
Submission:
Suppose that a rumor spreads at UWEC, and that the differential equation in the example above models how the rumor spreads. If there are
students at UWEC, and at time
weeks, exactly
people are aware of the rumor, then find the exact solution for the problem, assuming that
. Plot your solution and use your graph to estimate how many weeks it will take for all students to be aware of the rumor. At what time is the rumor spreading the most rapidly? How many students know the rumor at this time?
Submission worksheet:
The strength of a beam is proportional to the width of the beam times the square of its depth. In other words, if we let
represent the strength,
the depth and
the width, then
, where
is some constant of proportionality.
Let us begin by finding the dimensions of the strongest beam that can be cut from a 12 in diameter
cylindrical log. Note that we can always cut a rectangle of dimension
times
as long as
. This allows us to express
as a function of one variable. In this case we can solve the problem easily if we use
as the independent variable, because we then have the simple formula for
,
> S:=w->k*w*(144-w^2);
Note that the feasible domain for the problem is 0..12. Also, at the endpoints, it is clear that
. Thus we should look for the place where the derivative is equal to zero.
> solve(D(S)(w)=0,w);
Let us apply the second derivative test at
to show that it corresponds to a local maximum.
> (D@@2)(S)(4*sqrt(3));
Since
, this is a local maximum because the curve is concave down at this point. In order to graph this function, we need to choose a value for the proportionality constant. Let us assume
. and then plot the resulting curve.
> k:=1;plot(S,1..12);
Notice that the maximum occurs at
exactly
, which is
approximately
. The maximum strength is
approximately
> evalf(S(4*sqrt(3)));
We could also have expressed
as a function of the depth
, which would result in a different formula, and a different graph, but the value for the maximum would remain the same. Let us verify this.
> S:=d->k*sqrt(144-d^2)*d^2;
> S(d);
> solve(D(S)(d)=0);
> evalf(S(4*sqrt(6)));
> plot(S,0..12);
Let us plot the curve for
in terms of
, for some various values of
.
> k:='k';
> curves:=seq(k*sqrt(144-d^2)*d^2,k=1..4);
> plot([curves],d=0..12);
Notice that though the maximum value of
depends on
, it reaches its maximum value at the same value of
no matter what the value of
is.
Submission:
Consider a log that is 1 meter (100 cm.) in diameter.
(a) Find the dimensions of the strongest beam that can be cut from the 100 cm. diameter log.
(b) Graph the strength, S , as a function of the beam's width w, assuming the proportionality constant to be k=1 .
Reconcile what you see with your answer in part (a).
(c) Now graph the strength,
S,
as a function of the beam's width
d
. (What is the point of this exercise?)
Graph S using several values for
k
, say
.
Submission worksheet: